<template>
	
	<el-table :data="tableData" border height="400" style="width:80%">
		<el-table-column prop="no" label="" width＝"100%">
		</el-table-column>
		<el-table-column prop="K1" label="星期一" width="120"></el-table-column>
		<el-table-column prop="K2" label="星期二" width="120"></el-table-column>
		<el-table-column prop="K3" label="星期三" width="120"></el-table-column>
		<el-table-column prop="K4" label="星期四" width="120"></el-table-column>
		<el-table-column prop="K5" label="星期五"></el-table-column>
	</el-table>
	
</template>

<script>
import axios from 'axios';
import _ from 'lodash';
import Layout from './Home.vue' 
	export default{
		components:{
			Layout
		},
		data(){
			return {
				tableData:[],
			}
		},
		mounted(){
			let vm = this;
			axios.get('/api/hh/getKB',{
				params:{
					xn:'2016',
					xq:1,
					dm:'0000356'
				}
			}).then(function(r){
				console.log(JSON.stringify(r));
				if(r.data.errorCode != '0'){
					vm.$message({
						message:'获取数据失败',
						type:'error',
					});
					return;
				}
				vm.data = r.data.obj;
				_(4).times(i=>{
					let obj = {};
					_(5).times(j=>{
						let k = 'K'+(j+1);
						let l = k + (i+1);
						obj[k] = vm.data.filter(o=>o.jcz.startsWith(l)).map(o=>{
								return o.zwmc + ',' + o.bjmc;
						}).join('-----');
					});
					vm.tableData.push(obj);
				});
			}).catch(e=>{
				console.log(e);
			});
		}
	}
</script>